import http from "@/utils/http";
import type { GetList, Page } from "./type";

/**
 * 创建自有供应商
 */
export const addOwnVmi = (data: any) => {
  return http.post("/mall/tenant/merchant/tenant/add", data);
};
/**
 * 查询自有供应商详情
 */
export const getOwnVmiDetail = (data: any) => {
  return http.get(`/mall/tenant/merchant/tenant/getProvideInfo/${data.factoryId}`);
};

/**
 * 编辑自有供应商
 */
export const editOwnVmi = (data: any) => {
  return http.put(`/mall/tenant/merchant/tenant/edit/${data.factoryId}`, data);
};

/**
 * 分页查询列表
 */
export const getVendorList = (params: Page, data: GetList) => {
  return http.post(`/mall/tenant/merchant/tenant/getProvideList?current=${params.current}&size=${params.size}`, data);
};

/**
 * 获取行政区域
 */
export const getAreaList = () => {
  return http.get("/dbo/region/tree");
};

/**
 * 禁用供应商
 */
export const disableVendor = (factoryId: string) => {
  return http.post(`/mall/tenant/merchant/tenant/forbidden/${factoryId}`);
};
/**
 * 启用供应商
 */
export const enableVendor = (factoryId: string) => {
  return http.post(`/mall/tenant/merchant/tenant/enable/${factoryId}`);
};
/**
 * 查询供应商详情
 */
export const getVendorDetail = (factoryId: string) => {
  return http.get(`/mall/tenant/merchant/tenant/getProvideDetail/${factoryId}`);
};
/**
 * 查询商品分类tree
 */
export const getcategoryList = (props: any) => {
  return http.get("/mall/admin/category/getcategoryList?search=" + props.searchkey);
};
/**
 * 获取品牌列表
 */
export const getBrandInfoList = (props: any) => {
  return http.get(`/mall/tenant/brand/getBrandInfoList/${props.factoryId}`);
};
/**
 * 添加、保存品牌信息
 */
export const saveBrandInfo = (props: any) => {
  return http.post("/mall/tenant/brand/saveBrandInfo", props);
};
/**
 * 查询品牌详情信息
 */
export const getBrandInfo = (props: any) => {
  return http.get(`/mall/tenant/brand/getBrandInfo/${props.brandId}`);
};
/**
 * 删除品牌
 */
export const deleteBrandInfo = (props: any) => {
  return http.get(`/mall/tenant/brand/deleteBrandInfo/${props.brandId}`);
};

